package com.framework.network.utils

import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken

/**
 * @ClassName: JsonToMapUtil
 * @Description:
 * @Author: you
 */
object JsonToMapUtil {
    /**
     * 将string转map，防止Int转成double
     */
    fun gsonToMap(strJson: String): HashMap<String, Any>? {
        val gson = GsonBuilder().registerTypeAdapter(object : TypeToken<HashMap<String, Any>>() {}.type, MapTypeUtil()).create()
        return gson.fromJson<HashMap<String, Any>>(strJson, object : TypeToken<HashMap<String, Any>>() {}.type)
    }
}